/*
 * @Author: yayalee yangcheng960813@163.com
 * @Date: 2023-11-03 18:45:16
 * @LastEditTime: 2023-11-03 21:58:55
 * @LastEditors: yayalee yangcheng960813@163.com
 * @Description: 
 * @FilePath: \double-11-war\assets\script\data\MessageConfig.ts
 * 可以输入预定的版权声明、个性签名、空行等
 */
import _js from "../../cocos-libs/_/_js";
import _proxy from "../../cocos-libs/_/_proxy";
import _random from "../../cocos-libs/_/_random";

class MessageConfig extends _proxy<Record<string, IMessage>>{

    #array: IMessage[] = [];

    protected onLoad(): void {
        super.onLoad();
        _js.forIn(this._data, (value) => {
            this.#array.push(value);
        });
    }

    get length(): number {
        return _js.size(this.#array);
    }

    random(): IMessage {
        return _random.arrayRandom(this.#array);
    }

}

const messageCfg = new MessageConfig();

export default messageCfg;